package com.imooc.service.impl;

import com.imooc.common.utils.PagedGridResult;
import com.imooc.dto.items.SearhItemsRequest;
import com.imooc.mapper.ItemsMapper;
import com.imooc.pojo.Items;
import com.imooc.pojo.ItemsImg;
import com.imooc.pojo.ItemsParam;
import com.imooc.pojo.ItemsSpec;
import com.imooc.pojo.vo.CommentLevelCountsVO;
import com.imooc.pojo.vo.ShopcartVO;
import com.imooc.service.IItemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ClassName: ItemServiceImpl
 * @Description: 商品 Service 接口实现
 * @author: limingxing
 * @Date: 2019-12-27 14:55
 */
@Slf4j
@Service
public class ItemServiceImpl implements IItemService {

    @Autowired
    private ItemsMapper itemsMapper;

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public Items queryItemById(String itemId) {
        log.info("Begin ItemServiceImpl.queryItemById itemId: [{}]",itemId);
        return itemsMapper.selectByPrimaryKey(itemId);
    }

    @Override
    public List<ItemsImg> queryItemImgList(String itemId) {
        log.info("Begin ItemServiceImpl.queryItemImgList itemId: [{}]",itemId);
        return null;
    }

    @Override
    public List<ItemsSpec> queryItemSpecList(String itemId) {
        log.info("Begin ItemServiceImpl.queryItemSpecList itemId: [{}]",itemId);
        return null;
    }

    @Override
    public ItemsParam queryItemParam(String itemId) {
        log.info("Begin ItemServiceImpl.queryItemParam itemId: [{}]",itemId);
        return null;
    }

    @Override
    public CommentLevelCountsVO queryCommentCounts(String itemId) {
        log.info("Begin ItemServiceImpl.queryCommentCounts itemId: [{}]",itemId);
        return null;
    }

    @Override
    public PagedGridResult queryPagedComments(String itemId, Integer level, Integer page, Integer pageSize) {
        log.info("Begin ItemServiceImpl.queryCommentCounts itemId: [{}]",itemId);
        return null;
    }

    @Override
    public PagedGridResult searhItems(String keywords, String sort, Integer page, Integer pageSize) {
        log.info("Begin ItemServiceImpl.searhItems keywords: [{}]",keywords);
        return null;
    }

    @Override
    public PagedGridResult searhItems(SearhItemsRequest request) {
        log.info("Begin ItemServiceImpl.searhItems SearhItemsRequest: [{}]",request);
        return null;
    }

    @Override
    public List<ShopcartVO> queryItemsBySpecIds(String specIds) {
        log.info("Begin ItemServiceImpl.queryItemsBySpecIds specIds: [{}]",specIds);
        return null;
    }

    @Override
    public ItemsSpec queryItemSpecById(String specId) {
        log.info("Begin ItemServiceImpl.queryItemSpecById specId: [{}]",specId);
        return null;
    }

    @Override
    public String queryItemMainImgById(String itemId) {
        log.info("Begin ItemServiceImpl.queryItemMainImgById itemId: [{}]",itemId);
        return null;
    }

    @Override
    public void decreaseItemSpecStock(String specId, int buyCounts) {
        log.info("Begin ItemServiceImpl.decreaseItemSpecStock specId: [{}]",specId);

    }
}
